package com.xyd.Servlet;

import com.xyd.Biz.FatherOrderBiz;
import com.xyd.Biz.Impl.FatherOrderBizImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/html/manage/DelFatherOrderServlet")
public class DelFatherOrderServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        long orderId = Long.parseLong(request.getParameter("fatherOrderId"));


        FatherOrderBiz fatherOrderBiz = new FatherOrderBizImpl();
        int flag = fatherOrderBiz.delFatherOrderByID(orderId);

        if (flag>=1){
            response.sendRedirect("manage-result.jsp");
        }else {
            response.sendRedirect("order-modify.jsp");
        }

    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
